﻿using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using TL_Cloud.Core.Entities;

namespace TL_Cloud.Models.BookShop
{
    public partial class Bk_DownloadRecord : BaseEntity
    {
        public string RecordId { get; set; }
        public string BookId { get; set; }
        public string DownloadUserId { get; set; }
        public string DownloadUserName { get; set; }
        /// <summary>
        /// 图书信息
        /// </summary>
        public virtual Bk_Info bookInfo { get; set; }

      
        public override void Create(string userId, string userName)
        {
            this.RecordId = Guid.NewGuid().ToString();
            this.CreateDate = DateTime.Now;
            this.DownloadUserId = userId; 
            this.DownloadUserName = userName;
        }
       
        public override void Mapping(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Bk_DownloadRecord>(entity =>
            {
                entity.HasKey(e => e.RecordId);

                entity.ToTable("BK_DownloadRecord");

                entity.Property(e => e.RecordId)
                    .HasMaxLength(50)
                    .IsUnicode(false)
                    .ValueGeneratedNever();

                entity.Property(e => e.BookId)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.CreateDate).HasColumnType("datetime");

                entity.Property(e => e.DownloadUserId)
                    .HasMaxLength(50)
                    .IsUnicode(false);
            });
        }
    }
}
